package com.cat.dataStructure03;

import java.util.HashSet;
import java.util.Set;

/**
 * @author 曲大人的喵
 * @description https://leetcode.cn/problems/bitwise-ors-of-subarrays/
 * @create 2025/11/6 20:42
 * @since JDK17
 */

public class Solution13 {
    public int subarrayBitwiseORs(int[] arr) {
        Set<Integer> ans = new HashSet<>(), ors = new HashSet<>();
        for (int x : arr) {
            Set<Integer> t = new HashSet<>(ors);
            for (int y : t) {
                ors.add(y | x);
            }
            ans.addAll(ors);
        }
        return ans.size();
    }
}
